// 21
package main

import (
	"fmt"
)

func main() {
	sum := 0
	for a := 2; a < 10000; a++ {
		b := d(a)
		if d(b) == a && a != b {
			sum += a
		}
	}
	fmt.Println(sum)
}

func d(a int) int {
	b := 0
	for i := 1; i <= (a+1)/2; i++ {
		if a%i == 0 {
			b += i
		}
	}
	return b
}
